/*     */ package com.yc.dao.station;
/*     */ 
/*     */ import btsm.bean.dbConnector;
/*     */ import com.yc.dao.model.AntennaFeederBO;
/*     */ import com.yc.util.FormateSQL;
/*     */ import com.yc.util.ListContentsBFO;
/*     */ import java.sql.ResultSet;
/*     */ import java.text.SimpleDateFormat;
/*     */ import java.util.ArrayList;
/*     */ import java.util.Date;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import org.apache.commons.logging.Log;
/*     */ import org.apache.commons.logging.LogFactory;
/*     */ 
/*     */ public class AntennaFeederDAO
/*     */ {
/*  21 */   private static final Log log = LogFactory.getLog(AntennaFeederDAO.class);
/*  22 */   private SimpleDateFormat open = new SimpleDateFormat("yyyy-MM-dd");
/*  23 */   private SimpleDateFormat fresh = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
/*  24 */   private dbConnector dbcon = null;
/*     */ 
/*  26 */   private void dbConInit() { if (this.dbcon == null)
/*  27 */       this.dbcon = new dbConnector(); }
/*     */ 
/*     */   private void dbConClose()
/*     */   {
/*  31 */     if (this.dbcon != null)
/*  32 */       this.dbcon.closeAll();
/*  33 */     this.dbcon = null;
/*     */   }
/*     */ 
/*     */   public ListContentsBFO getAntennaFeederList(Map condition)
/*     */   {
/*  39 */     ListContentsBFO bfo = new ListContentsBFO();
/*  40 */     int start = Integer.parseInt(condition.get("start").toString());
/*  41 */     int limit = Integer.parseInt(condition.get("limit").toString());
/*  42 */     String strBtscode = condition.get("BTS_CODE").toString();
/*  43 */     ResultSet rs = null;
/*  44 */     List list = new ArrayList();
/*     */     try
/*     */     {
/*  47 */       dbConInit();
/*  48 */       String strSQL = " select count(id) from antennafeeder where btscode = '" + strBtscode + "' ";
/*  49 */       log.info(strSQL);
/*  50 */       rs = this.dbcon.execQuery(strSQL);
/*  51 */       if (rs.next()) {
/*  52 */         bfo.setTotalSize(rs.getInt(1));
/*     */       }
/*  54 */       strSQL = " select * from antennafeeder where btscode ='" + strBtscode + "' limit " + start + ", " + limit;
/*  55 */       log.info(strSQL);
/*  56 */       rs = this.dbcon.execQuery(strSQL);
/*  57 */       while (rs.next()) {
/*  58 */         AntennaFeederBO bo = new AntennaFeederBO();
/*  59 */         bo.setId(rs.getString("id"));
/*  60 */         bo.setBtscode(rs.getString("btscode"));
/*  61 */         bo.setBtsname(rs.getString("btsname"));
/*  62 */         bo.setAntennaT(rs.getString("antennaT"));
/*  63 */         bo.setAntennaM(rs.getString("antennaM"));
/*  64 */         bo.setAntennaNum(rs.getString("antennaNum"));
/*  65 */         bo.setAntennaPlu(rs.getString("antennaPlu"));
/*  66 */         bo.setAntennaDir(rs.getString("antennaDir"));
/*  67 */         bo.setAntennaPT(rs.getString("antennaPT"));
/*  68 */         bo.setAntennaFB(rs.getString("antennaFB"));
/*  69 */         bo.setAntennaH(rs.getString("antennaH"));
/*  70 */         bo.setAntennaCRD(rs.getString("antennaCRD"));
/*  71 */         bo.setMagnifierT(rs.getString("magnifierT"));
/*  72 */         bo.setMagnifierM(rs.getString("magnifierM"));
/*  73 */         bo.setMagnifierNum(rs.getString("magnifierNum"));
/*  74 */         bo.setMagnifierCell(rs.getString("magnifierCell"));
/*  75 */         bo.setMagnifierCRD(rs.getString("magnifierCRD"));
/*  76 */         bo.setFeederT(rs.getString("feederT"));
/*  77 */         bo.setFeederM(rs.getString("feederM"));
/*  78 */         bo.setFeederLen(rs.getString("feederLen"));
/*  79 */         bo.setFeederNum(rs.getString("feederNum"));
/*  80 */         bo.setMaintenance(rs.getString("maintenance"));
/*  81 */         bo.setRefreshtime(rs.getDate("refreshtime"));
/*  82 */         bo.setMemo(rs.getString("memo"));
/*  83 */         bo.setAnteIsMakeAng(rs.getString("anteIsMakeAng"));
/*  84 */         bo.setAnteDicAng(rs.getString("anteDicAng"));
/*  85 */         bo.setAnteUpAng(rs.getString("anteUpAng"));
/*  86 */         list.add(bo);
/*     */       }
/*  88 */       bfo.setData(list.toArray());
/*     */     }
/*     */     catch (Exception e) {
/*  91 */       e.printStackTrace();
/*  92 */       log.error(e.getMessage());
/*     */     }
/*     */     finally {
/*  95 */       dbConClose();
/*     */     }
/*  97 */     return bfo;
/*     */   }
/*     */ 
/*     */   public boolean saveAntennaFeederBO(AntennaFeederBO bo)
/*     */   {
/* 102 */     log.info("添加--天馈---开始");
/* 103 */     boolean flag = true;
/*     */     try
/*     */     {
/* 106 */       dbConInit();
/* 107 */       StringBuffer sqlBuf = new StringBuffer();
/* 108 */       sqlBuf.append(" insert into antennafeeder ( btscode,  btsname, antennaT, antennaM,  antennaNum,");
/* 109 */       sqlBuf.append(" antennaPlu,  antennaDir,  antennaPT, antennaFB, antennaH, antennaCRD, magnifierT,");
/* 110 */       sqlBuf.append(" magnifierM, magnifierNum,  magnifierCell, magnifierCRD, feederT, feederM,");
/* 111 */       sqlBuf.append(" feederLen, feederNum, maintenance, refreshtime, memo,");
/* 112 */       sqlBuf.append(" anteIsMakeAng, anteDicAng,registtime ,anteUpAng ) values ( ");
/* 113 */       sqlBuf.append(" '" + bo.getBtscode() + "' ,");
/* 114 */       sqlBuf.append(" '" + bo.getBtsname() + "' ,");
/* 115 */       sqlBuf.append(" '" + bo.getAntennaT() + "' ,");
/* 116 */       sqlBuf.append(" '" + bo.getAntennaM() + "' ,");
/* 117 */       sqlBuf.append(" '" + bo.getAntennaNum() + "' ,");
/* 118 */       sqlBuf.append(" '" + bo.getAntennaPlu() + "' ,");
/* 119 */       sqlBuf.append(" '" + bo.getAntennaDir() + "' ,");
/* 120 */       sqlBuf.append(" '" + bo.getAntennaPT() + "' ,");
/* 121 */       sqlBuf.append(" '" + bo.getAntennaFB() + "' ,");
/* 122 */       sqlBuf.append(" '" + bo.getAntennaH() + "' ,");
/* 123 */       sqlBuf.append(" '" + bo.getAntennaCRD() + "' ,");
/* 124 */       sqlBuf.append(" '" + bo.getMagnifierT() + "' ,");
/* 125 */       sqlBuf.append(" '" + bo.getMagnifierM() + "' ,");
/* 126 */       sqlBuf.append(" '" + bo.getMagnifierNum() + "' ,");
/* 127 */       sqlBuf.append(" '" + bo.getMagnifierCell() + "' ,");
/* 128 */       sqlBuf.append(" '" + bo.getMagnifierCRD() + "' ,");
/* 129 */       sqlBuf.append(" '" + bo.getFeederT() + "' ,");
/* 130 */       sqlBuf.append(" '" + bo.getFeederM() + "' ,");
/* 131 */       sqlBuf.append(" '" + bo.getFeederLen() + "' ,");
/* 132 */       sqlBuf.append(" '" + bo.getFeederNum() + "' ,");
/* 133 */       sqlBuf.append(" '" + bo.getMaintenance() + "' ,");
/* 134 */       sqlBuf.append(" '" + this.fresh.format(new Date()) + "' ,");
/* 135 */       sqlBuf.append(" '" + bo.getMemo() + "' ,");
/* 136 */       sqlBuf.append(" '" + bo.getAnteIsMakeAng() + "' ,");
/* 137 */       sqlBuf.append(" '" + bo.getAnteDicAng() + "' ,");
/* 138 */       sqlBuf.append(" '" + this.open.format(new Date()) + "' ,");
/* 139 */       sqlBuf.append(" '" + bo.getAnteUpAng() + "' )");
/* 140 */       log.info(sqlBuf.toString());
/* 141 */       this.dbcon.execUpdate(sqlBuf.toString());
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/* 145 */       flag = false;
/* 146 */       e.printStackTrace();
/* 147 */       log.error(e.getMessage());
/*     */     }
/*     */     finally {
/* 150 */       dbConClose();
/*     */     }
/* 152 */     log.info("添加--天馈---结束");
/* 153 */     return flag;
/*     */   }
/*     */ 
/*     */   public boolean updateAntennaFeederBO(AntennaFeederBO bo)
/*     */   {
/* 159 */     log.info("修改--天馈---开始");
/* 160 */     boolean flag = true;
/*     */     try
/*     */     {
/* 163 */       dbConInit();
/* 164 */       StringBuffer sqlBuf = new StringBuffer();
/* 165 */       sqlBuf.append(" update antennafeeder set ");
/* 166 */       sqlBuf.append(" antennaT = '" + bo.getAntennaT() + "' ,");
/* 167 */       sqlBuf.append(" antennaM = '" + bo.getAntennaM() + "' ,");
/* 168 */       sqlBuf.append(" antennaNum = '" + bo.getAntennaNum() + "' ,");
/* 169 */       sqlBuf.append(" antennaPlu = '" + bo.getAntennaPlu() + "' ,");
/* 170 */       sqlBuf.append(" antennaDir = '" + bo.getAntennaDir() + "' ,");
/* 171 */       sqlBuf.append(" antennaPT = '" + bo.getAntennaPT() + "' ,");
/* 172 */       sqlBuf.append(" antennaFB = '" + bo.getAntennaFB() + "' ,");
/* 173 */       sqlBuf.append(" antennaH = '" + bo.getAntennaH() + "' ,");
/* 174 */       sqlBuf.append(" antennaCRD = '" + bo.getAntennaCRD() + "' ,");
/* 175 */       sqlBuf.append(" magnifierT = '" + bo.getMagnifierT() + "' ,");
/* 176 */       sqlBuf.append(" magnifierM = '" + bo.getMagnifierM() + "' ,");
/* 177 */       sqlBuf.append(" magnifierNum = '" + bo.getMagnifierNum() + "' ,");
/* 178 */       sqlBuf.append(" magnifierCell = '" + bo.getMagnifierCell() + "' ,");
/* 179 */       sqlBuf.append(" magnifierCRD = '" + bo.getMagnifierCRD() + "' ,");
/* 180 */       sqlBuf.append(" feederT = '" + bo.getFeederT() + "' ,");
/* 181 */       sqlBuf.append(" feederM = '" + bo.getFeederM() + "' ,");
/* 182 */       sqlBuf.append(" feederLen = '" + bo.getFeederLen() + "' ,");
/* 183 */       sqlBuf.append(" feederNum = '" + bo.getFeederNum() + "' ,");
/* 184 */       sqlBuf.append(" maintenance = '" + bo.getMaintenance() + "' ,");
/* 185 */       sqlBuf.append(" refreshtime = '" + this.fresh.format(new Date()) + "' ,");
/* 186 */       sqlBuf.append(" memo = '" + bo.getMemo() + "' ,");
/* 187 */       sqlBuf.append(" anteIsMakeAng = '" + bo.getAnteIsMakeAng() + "' ,");
/* 188 */       sqlBuf.append(" anteDicAng = '" + bo.getAnteDicAng() + "' ,");
/* 189 */       sqlBuf.append(" anteUpAng = '" + bo.getAnteUpAng() + "' ");
/* 190 */       sqlBuf.append(" where id = '" + bo.getId() + "'");
/* 191 */       log.info(sqlBuf.toString());
/* 192 */       this.dbcon.execUpdate(sqlBuf.toString());
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/* 196 */       flag = false;
/* 197 */       e.printStackTrace();
/* 198 */       log.error(e.getMessage());
/*     */     }
/*     */     finally {
/* 201 */       dbConClose();
/*     */     }
/* 203 */     log.info("修改--天馈---结束");
/* 204 */     return flag;
/*     */   }
/*     */ 
/*     */   public boolean deleteAntennaFeederBO(String strID)
/*     */   {
/* 210 */     log.info("删除--天馈---开始");
/* 211 */     boolean flag = true;
/*     */     try
/*     */     {
/* 214 */       dbConInit();
/* 215 */       StringBuffer sqlBuf = new StringBuffer();
/* 216 */       sqlBuf.append(" delete from  antennafeeder ");
/* 217 */       sqlBuf.append(" where id = '" + strID + "'");
/* 218 */       log.info(sqlBuf.toString());
/* 219 */       this.dbcon.execUpdate(sqlBuf.toString());
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/* 223 */       flag = false;
/* 224 */       e.printStackTrace();
/* 225 */       log.error(e.getMessage());
/*     */     }
/*     */     finally {
/* 228 */       dbConClose();
/*     */     }
/* 230 */     log.info("删除--天馈---结束");
/* 231 */     return flag;
/*     */   }
/*     */ 
/*     */   public ListContentsBFO getAntennaFeederByBtsName(Map condition)
/*     */   {
/* 236 */     ListContentsBFO bfo = new ListContentsBFO();
/* 237 */     int start = Integer.parseInt(condition.get("start").toString());
/* 238 */     int limit = Integer.parseInt(condition.get("limit").toString());
/* 239 */     String strBtsName = condition.get("btsName").toString();
/* 240 */     ResultSet rs = null;
/* 241 */     List list = new ArrayList();
/*     */     try
/*     */     {
/* 244 */       dbConInit();
/* 245 */       Object objRegistBeginTime = condition.get("registBeginTime");
/* 246 */       Object objRegistEndTime = condition.get("registEndTime");
/*     */ 
/* 248 */       String strSQL = " select count(id) from antennafeeder where btsname like '%" + strBtsName + "%' ";
/* 249 */       strSQL = FormateSQL.getFormateSQL(objRegistBeginTime, objRegistEndTime, strSQL);
/* 250 */       log.info(strSQL);
/* 251 */       rs = this.dbcon.execQuery(strSQL);
/* 252 */       if (rs.next()) {
/* 253 */         bfo.setTotalSize(rs.getInt(1));
/*     */       }
/* 255 */       strSQL = " select * from antennafeeder where btsname like '%" + strBtsName + "%' ";
/* 256 */       strSQL = FormateSQL.getFormateSQL(objRegistBeginTime, objRegistEndTime, strSQL);
/* 257 */       strSQL = strSQL + "limit " + start + ", " + limit;
/* 258 */       log.info(strSQL);
/* 259 */       rs = this.dbcon.execQuery(strSQL);
/* 260 */       while (rs.next()) {
/* 261 */         AntennaFeederBO bo = new AntennaFeederBO();
/* 262 */         bo.setId(rs.getString("id"));
/* 263 */         bo.setBtscode(rs.getString("btscode"));
/* 264 */         bo.setBtsname(rs.getString("btsname"));
/* 265 */         bo.setAntennaT(rs.getString("antennaT"));
/* 266 */         bo.setAntennaM(rs.getString("antennaM"));
/* 267 */         bo.setAntennaNum(rs.getString("antennaNum"));
/* 268 */         bo.setAntennaPlu(rs.getString("antennaPlu"));
/* 269 */         bo.setAntennaDir(rs.getString("antennaDir"));
/* 270 */         bo.setAntennaPT(rs.getString("antennaPT"));
/* 271 */         bo.setAntennaFB(rs.getString("antennaFB"));
/* 272 */         bo.setAntennaH(rs.getString("antennaH"));
/* 273 */         bo.setAntennaCRD(rs.getString("antennaCRD"));
/* 274 */         bo.setMagnifierT(rs.getString("magnifierT"));
/* 275 */         bo.setMagnifierM(rs.getString("magnifierM"));
/* 276 */         bo.setMagnifierNum(rs.getString("magnifierNum"));
/* 277 */         bo.setMagnifierCell(rs.getString("magnifierCell"));
/* 278 */         bo.setMagnifierCRD(rs.getString("magnifierCRD"));
/* 279 */         bo.setFeederT(rs.getString("feederT"));
/* 280 */         bo.setFeederM(rs.getString("feederM"));
/* 281 */         bo.setFeederLen(rs.getString("feederLen"));
/* 282 */         bo.setFeederNum(rs.getString("feederNum"));
/* 283 */         bo.setMaintenance(rs.getString("maintenance"));
/* 284 */         bo.setRefreshtime(rs.getDate("refreshtime"));
/* 285 */         bo.setMemo(rs.getString("memo"));
/* 286 */         bo.setAnteIsMakeAng(rs.getString("anteIsMakeAng"));
/* 287 */         bo.setAnteDicAng(rs.getString("anteDicAng"));
/* 288 */         bo.setAnteUpAng(rs.getString("anteUpAng"));
/* 289 */         list.add(bo);
/*     */       }
/* 291 */       bfo.setData(list.toArray());
/*     */     }
/*     */     catch (Exception e) {
/* 294 */       e.printStackTrace();
/* 295 */       log.error(e.getMessage());
/*     */     }
/*     */     finally {
/* 298 */       dbConClose();
/*     */     }
/* 300 */     return bfo;
/*     */   }
/*     */ 
/*     */   public List export(String strBtsName, String strRegistBeginTime, String strRegistEndTime)
/*     */   {
/* 305 */     ResultSet rs = null;
/* 306 */     List list = new ArrayList();
/*     */     try
/*     */     {
/* 309 */       dbConInit();
/* 310 */       String strSQL = " select * from antennafeeder where btsname like '%" + strBtsName + "%'";
/* 311 */       strSQL = FormateSQL.getFormateSQL(strRegistBeginTime, strRegistEndTime, strSQL);
/* 312 */       log.info(strSQL);
/* 313 */       rs = this.dbcon.execQuery(strSQL);
/*     */ 
/* 315 */       while (rs.next()) {
/* 316 */         AntennaFeederBO bo = new AntennaFeederBO();
/* 317 */         bo.setId(rs.getString("id"));
/* 318 */         bo.setBtscode(rs.getString("btscode"));
/* 319 */         bo.setBtsname(rs.getString("btsname"));
/* 320 */         bo.setAntennaT(rs.getString("antennaT"));
/* 321 */         bo.setAntennaM(rs.getString("antennaM"));
/* 322 */         bo.setAntennaNum(rs.getString("antennaNum"));
/* 323 */         bo.setAntennaPlu(rs.getString("antennaPlu"));
/* 324 */         bo.setAntennaDir(rs.getString("antennaDir"));
/* 325 */         bo.setAntennaPT(rs.getString("antennaPT"));
/* 326 */         bo.setAntennaFB(rs.getString("antennaFB"));
/* 327 */         bo.setAntennaH(rs.getString("antennaH"));
/* 328 */         bo.setAntennaCRD(rs.getString("antennaCRD"));
/* 329 */         bo.setMagnifierT(rs.getString("magnifierT"));
/* 330 */         bo.setMagnifierM(rs.getString("magnifierM"));
/* 331 */         bo.setMagnifierNum(rs.getString("magnifierNum"));
/* 332 */         bo.setMagnifierCell(rs.getString("magnifierCell"));
/* 333 */         bo.setMagnifierCRD(rs.getString("magnifierCRD"));
/* 334 */         bo.setFeederT(rs.getString("feederT"));
/* 335 */         bo.setFeederM(rs.getString("feederM"));
/* 336 */         bo.setFeederLen(rs.getString("feederLen"));
/* 337 */         bo.setFeederNum(rs.getString("feederNum"));
/* 338 */         bo.setMaintenance(rs.getString("maintenance"));
/* 339 */         bo.setRefreshtime(rs.getDate("refreshtime"));
/* 340 */         bo.setMemo(rs.getString("memo"));
/* 341 */         bo.setAnteIsMakeAng(rs.getString("anteIsMakeAng"));
/* 342 */         bo.setAnteDicAng(rs.getString("anteDicAng"));
/* 343 */         bo.setAnteUpAng(rs.getString("anteUpAng"));
/* 344 */         list.add(bo);
/*     */       }
/*     */     }
/*     */     catch (Exception e) {
/* 348 */       e.printStackTrace();
/* 349 */       log.error(e.getMessage());
/*     */     }
/*     */     finally {
/* 352 */       dbConClose();
/*     */     }
/* 354 */     return list;
/*     */   }
/*     */ }

/* Location:           E:\java\apache-tomcat-6.0.36\webapps\btsm\WEB-INF\classes\
 * Qualified Name:     com.yc.dao.station.AntennaFeederDAO
 * JD-Core Version:    0.6.2
 */